<?php
include("../../inc/conn.inc");
include("../islogin.php");
$url="info.php";
$thepage=$_GET['page']?$_GET['page']:1;
$maxpage=10;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心-三帝贸易网</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../js/left.js"></script>
<body>
<div class="right">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
   <TR>
     <TD height="40" bgcolor="#EFF6FF" style="font-size:18px;font-weight:bold;padding-left:8px;">图库管理</TD>
   </TR>
</TABLE>
<br>
<table width="100%" cellspacing="1" bgcolor="#C1DCF5">
        <tr>
          <td width="8%" height="30" align="center" bgcolor="#EFF6FF">编号</td>
          <td width="27%" align="center" bgcolor="#EFF6FF">图片</td>
          <td width="32%" align="center" bgcolor="#EFF6FF">图片地址</td>
          <td width="16%" align="center" bgcolor="#EFF6FF">时间</td>
          <td width="17%" align="center" bgcolor="#EFF6FF">管理操作</td>
        </tr>
<?php
$sql="select p_url,p_addtime from photo where member_id='".$_COOKIE['user_id']."' order by id desc limit ".($thepage-1)*$maxpage.",$maxpage";
$rs=mysql_query($sql);
$i=1;
while($row=mysql_fetch_array($rs)){
		?>
        <tr>
          <td height="22" align="center" bgcolor="#FFFFFF"><?=$i?></td>
          <td align="center" bgcolor="#FFFFFF"><?php if($row[p_url]){?><a href="/upfile/<?=$row[p_url]?>" target="_blank"><img src="/upfile/<?=$row[p_url]?>" width="60" height="60" border="0"></a><?php }?></td>
          <td align="center" bgcolor="#FFFFFF"><?=$row[p_url]?></td>
          <td align="center" bgcolor="#FFFFFF"><?php if($row[p_addtime]>=date("Y-m-d")){?><font color="#FF0000"><?=date("Y-m-d",strtotime($row[p_addtime]))?></font><?php }else{?><?=date("Y-m-d",strtotime($row[p_addtime]))?><?php }?></td>
          <td align="center" bgcolor="#FFFFFF"><a href="javascript:opener.document.form1.picture.value='<?=$row[p_url]?>';opener.document.getElementById('picture').src='/upfile/<?=$row[p_url]?>';window.close();">选择</a></td>
        </tr>
<?php
$i++;
}?>
<?php
$rs2=@mysql_query("select count(id) from photo where member_id='".$_COOKIE['user_id']."'");
$totalrecord=@mysql_result($rs2,0);
$totalpage=ceil($totalrecord/$maxpage);
@mysql_free_result($rs2);
if($totalpage>0){
?>
        <tr>
          <td colspan="5" align="center" bgcolor="#FFFFFF" height="18"><script language="javascript">
<!--
function showPageLink(sUrl,iPage,iCount){
	var i;
	i=Math.max(1,iPage-1);
	document.write("<a href=\"" + sUrl + "1\">«</a> ");
	document.write("<a href=\"" + sUrl + i + "\">上一页</a> ");
	for(i=Math.max(1,iPage-8);i<iPage;i++){
		document.write("<a href=\""+sUrl + i + "\"><b>" + i + "</b></a> ");
	}
	document.write("<font color='#ff3333'><b>" + iPage + "</b></font> ");
	for(i=iPage+1;i<=Math.min(iCount,iPage+8);i++){
		document.write("<a href=\""+sUrl + i + "\"><b>" + i + "</b></a> ");
	}
	i=Math.min(iCount,iPage+1);
	if(iCount>iPage+8) document.write("<span style='font-size:8px'>···</span> ");
	document.write("<a href=\"" + sUrl + i + "\">下一页</a> ");
	document.write("<a href=\"" + sUrl + iCount + "\">»</a> ");
}
showPageLink("<?=$url?>?page=",<?=$thepage?>,<?=$totalpage?>);
//-->
</script></td>
        </tr><?php }?>
    </table>
</div>
</body>
</html>
